// 导入type
import { TOKEN_KEY, TOKEN_REMOVE } from '../actionTypes'
// 默认从本地获取token
import { getToken } from '@/utils/auth.js'
const initToken = getToken()
export function token(state = initToken, action) {
  switch (action.type) {
    // 设置token
    case TOKEN_KEY:
      return action.payload
    // 删除token
    case TOKEN_REMOVE:
      return ''
    default:
      return state
  }
}
